package com.example.demo;

import cn.dev33.satoken.SaManager;
import com.example.demo.service.AnimalService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) throws JsonProcessingException  {
        SpringApplication.run(DemoApplication.class, args);
        System.out.println("Hello World!");
        System.out.println("启动成功，Sa-Token 配置如下：" + SaManager.getConfig());

    }

    // 会在 hello world 之前打印 出来
    @Bean
    public CommandLineRunner commandLineRunner(AnimalService animalService) {
        return args -> {
            System.out.println(animalService.makeSound());
        };
    }

}
